package vip.meeet.tool.font;

import org.junit.jupiter.api.Test;

import java.awt.*;

public class CustomeFontReading {

    @Test
    public void test() {
        String[] fonts = GraphicsEnvironment  // GraphicsEnvironment(抽象类)  图形环境类
                .getLocalGraphicsEnvironment()  // 获取本地图形环境
                .getAvailableFontFamilyNames();  // 获取可用字体family名

        int fontCount = 0;   // 字体数统计
        for (String font : fonts) {
            fontCount++;
            System.out.println(font);
        }
        System.out.println("系统字体数:" + fontCount);
    }

    @Test
    public void font(){
        Font[] fonts = GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getAllFonts();
        for (Font font : fonts) {
            System.out.println(font.getFontName());
//            System.out.println(font.getPSName());
        }
        System.out.println("字体数量:" + fonts.length);
    }
}
